using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using System.Transactions;
using GC2.Entities.Admin;
using GC2.ExceptionHandler.Services;
using GC2.DataAccess.DAAdmin;

namespace GC2.Bussines.BMAdmin
{
    public class BMRemitoN
    {
        public BMRemitoN(string coneccion)
        {
            this.Connection = coneccion;
        }

        private string connection = "";
        public string Connection
        {
            get { return connection; }
            set { connection = value; }
        }

        DARemitoN daRemitoN = new DARemitoN();
        List<RemitoN> listaRemitoN = new List<RemitoN>();

        #region RemitoNGetOne
        public RemitoN RemitoNGetOne(RemitoN remito)
        {
            try
            {
                RemitoN oRemitoN = daRemitoN.DARemitoNGetOne(connection, remito);
                return oRemitoN;
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region RemitoNInsert
        public void RemitoNInsert(RemitoN remito)
        {
            try
            {
                daRemitoN.DARemitoNInsert(connection, remito);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
        }
        #endregion

        #region RemitoNProximoNumero
        public int RemitoNProximoNumero(RemitoN remito)
        {
            int iProximo = 0;
            try
            {
                iProximo = daRemitoN.DARemitoProximoNumero(connection, remito);
            }
            catch (Exception ex)
            {
                ExceptionBM exNew = new ExceptionBM();
                throw new System.Exception(exNew.exBM(ex.ToString()).ToString());
            }
            return iProximo;
        }
        #endregion
    }
}

